package com.ybbase.framework.base.model;

import lombok.*;

/**
 * 统一返回Bean, 包括code[int]、msg[String]、data[Object]
 *
 * @author chengang
 * @date 2019-8-1
 * @since 4.0
 */
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class ResponseBean {

    /**
     * 系统统一返回码
     */
    @Getter
    @Setter
    private int code;
    /**
     * 返回信息
     */
    @Getter
    @Setter
    private String msg;
    /**
     * 返回的数据
     */
    @Getter
    @Setter
    private Object data;

    @Getter
    @Setter
    private TreeMessage status;

    public ResponseBean(final int code, final String msg,final Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * 增加只有返回码和值的统一返回对象
     *
     * @param code 返回码
     * @param msg  返回码对应的值
     * @since 4.0
     */
    public ResponseBean(final int code, final String msg) {
        this.code = code;
        this.msg = msg;
        this.data = "";
    }

    public ResponseBean(final TreeMessage status,final Object data) {
        this.status = status;
        this.data = data;
    }

}